package com.googlecode.framework.core.exception.monitor.support;

import java.util.List;

import org.springframework.util.CollectionUtils;

import com.googlecode.framework.core.exception.monitor.ExceptionMonitor;
import com.googlecode.framework.core.exception.monitor.ExceptionMonitorEvent;

public class CompositeExceptionMonitor implements ExceptionMonitor {
    
    /**
     * 异常监听器
     */
    private List<ExceptionMonitor> monitors;
    
    public CompositeExceptionMonitor(List<ExceptionMonitor> monitors) {
        this.monitors = monitors;
    }

    /*
     * (non-Javadoc)
     * @see com.googlecode.framework.interceptor.ExceptionMonitor#monitor(com.googlecode.framework.interceptor.ExceptionMonitorEvent)
     */
    @Override
    public void monitor(ExceptionMonitorEvent event) {
        if (CollectionUtils.isEmpty(monitors)) {
            return;
        }
        for (ExceptionMonitor monitor : monitors) {
            monitor.monitor(event);
        }
    }
}
